﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MySql.Data.MySqlClient;
using System.Data;

namespace GZ.Entity
{
    /// <summary>
    /// 系统用户实体类
    /// </summary>
    public class ESysUser
    {
        #region 属性
        private int id;

        public int Id
        {
            get { return id; }
            set { id = value; }
        }
        private string username;

        public string UserName
        {
            get { return username; }
            set { username = value; }
        }
        private string userpwd;

        public string UserPwd
        {
            get { return userpwd; }
            set { userpwd = value; }
        }
        private int isdelete;

        public int IsDelete
        {
            get { return isdelete; }
            set { isdelete = value; }
        }

        #endregion

        /// <summary>
        /// 登陆方法
        /// </summary>
        /// <returns></returns>
        public bool Login(string UserName, string UserPWD)
        {
            string sql = "SELECT * FROM tb_sysuser WHERE UserName=@UserName AND UserPwd=@UserPwd AND IsDelete=0;";
            MySqlParameter[] parameters = new MySqlParameter[2];
            parameters[0] = new MySqlParameter("@UserName", UserName);
            parameters[1] = new MySqlParameter("@UserPwd", UserPWD);
            DataTable dt = MySqlHelper.ExecuteDataset(GZ.DAL.MySQLHelper.connStr, sql, parameters).Tables[0];
            if (dt.Rows.Count > 0)
            {
                return true;
            }
            else
            {
                return false;
            }

        }


    }
}
